﻿#region File Header
/***********************************************************************
 * Copyright © 2013 Beals Software
 * All Rights Reserved
************************************************************************
Author: Donald Beals
Date: February 4th, 2013
Description: TODO: Write a description of this file here.
****************************** Change Log ******************************
02.04.13 - Created initial file. (dbeals)
***********************************************************************/
#endregion

#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace GameJolt.Async
{
	/// <summary>
	/// 
	/// </summary>
	public class AsyncResult<TValue> : AsyncResultNoResult
	{
		#region Variables
		private TValue result = default(TValue);
		#endregion

		#region Constructors
		public AsyncResult(AsyncCallback asyncCallback, object state, object coreData) :
			base(asyncCallback, state, coreData)
		{
		}
		#endregion

		#region Methods
		public void SetAsCompleted(TValue result, bool completedSynchronously)
		{
			this.result = result;
			base.SetAsCompleted(null, completedSynchronously);
		}

		public new TValue EndInvoke()
		{
			base.EndInvoke();
			return result;
		}
		#endregion
	}
}
